home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 3539 < prev    next >
Encoding:
Text File  |  1996-08-06  |  732 b   |  27 lines

  1. Path: utpapa.ph.utexas.edu!tian
  2. From: tian@utpapa.ph.utexas.edu (Shiyang Tian)
  3. Newsgroups: comp.lang.c++
  4. Subject: [help] 3D Array class
  5. Date: 24 Jan 1996 18:07:04 GMT
  6. Organization: Physics Department, University of Texas at Austin
  7. Message-ID: <4e5sg8$r4h@geraldo.cc.utexas.edu>
  8. NNTP-Posting-Host: utpapa.ph.utexas.edu
  9.  
  10. Hi,
  11.  
  12. I'd like to construct a 3D array class which can take negative indices. 
  13. What's the best way to do it? A related question: is it possible to
  14. overload operator [][][] so that I can write something like following?
  15.  
  16. class array3D { ... };
  17.  
  18. array3D x;
  19. array3D *y;
  20.  
  21. y = new array3D(X, Y. Z);        // index for y is from -X to X, ... 
  22. (*y)[1][2][-3] = x[-1][-2][3];
  23.  
  24. Any pointer is greatly appreciated!
  25.  
  26. -- Tian
  27.